﻿using System.Web.Mvc;
using System.Web.Routing;

namespace MvcPaging
{
    public static class PagingExtensions
    {
        #region HtmlHelper extensions

        //public static string Pager(this HtmlHelper htmlHelper,string updateTargetId, int pageSize, int currentPage, int totalItemCount)
        //{
        //    return Pager(htmlHelper, updateTargetId, pageSize, currentPage, totalItemCount, null, null);
        //}

        //public static string Pager(this HtmlHelper htmlHelper,string updateTargetId, int pageSize, int currentPage, int totalItemCount, string actionName)
        //{
        //    return Pager(htmlHelper, updateTargetId, pageSize, currentPage, totalItemCount, actionName, null);
        //}

        //public static string Pager(this HtmlHelper htmlHelper,string updateTargetId, int pageSize, int currentPage, int totalItemCount, object values)
        //{
        //    return Pager(htmlHelper, updateTargetId, pageSize, currentPage, totalItemCount, null, new RouteValueDictionary(values));
        //}

        //public static string Pager(this HtmlHelper htmlHelper,string updateTargetId, int pageSize, int currentPage, int totalItemCount, string actionName, object values)
        //{
        //    return Pager(htmlHelper, updateTargetId, pageSize, currentPage, totalItemCount, actionName, new RouteValueDictionary(values));
        //}

        //public static string Pager(this HtmlHelper htmlHelper,string updateTargetId, int pageSize, int currentPage, int totalItemCount, RouteValueDictionary valuesDictionary)
        //{
        //    return Pager(htmlHelper, updateTargetId, pageSize, currentPage, totalItemCount, null, valuesDictionary);
        //}

        public static string Pager(this HtmlHelper htmlHelper, string updateTargetId, int pageSize, int currentPage,
                                   int totalItemCount, object routeValues)
        {
            var pager = new Pager(htmlHelper.ViewContext, updateTargetId, pageSize, currentPage, totalItemCount,
                                  new RouteValueDictionary(routeValues));
            return pager.RenderHtml();
        }

        #endregion
    }
}